package com.satan.vote.controller;

import com.satan.vote.entity.VoteItem;
import com.satan.vote.service.VoteItemService;
import com.satan.vote.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName VoteItemController
 * @Description TODO
 * @date 2023/8/16 14:10
 * @Version 1.0
 */
@RestController
@RequestMapping("/voteItem")
public class VoteItemController {

    @Autowired
    private VoteItemService voteItemService;

    /**
     * 获取指定投票的投票项排名
     *
     * @param voteId
     * @return 新建rank页面
     */
    @GetMapping("/rank/{voteId}")
    public ResultVO getRankByVoteId(@PathVariable(value = "voteId") Integer voteId) {
        return voteItemService.getRankByVoteId(voteId);
    }
}
